package wang.hu.bos.service.system.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import wang.hu.bos.dao.system.MenuDao;
import wang.hu.bos.domain.system.Menu;
import wang.hu.bos.service.system.MenuService;

@Service
@Transactional
public class MenuServiceImpl implements MenuService {
	@Autowired
	private MenuDao menuDao;

	@Override
	public List<Menu> findAll() {
		return menuDao.findAll();

	}

	@Override
	public void save(Menu menu) {
		if (menu.getParentMenu() == null || menu.getParentMenu().getId() == 0) {
			menu.setParentMenu(null);
		}
		menuDao.save(menu);

	}

}
